package com.gnerv.battle.boot.security.autoconfigure;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @author Gnerv LiGen
 */
@Data
@ConfigurationProperties(prefix = "battle.security")
public class BattleSecurityConfigProperties {

    private static final String SUPER_ADMIN = "super_admin";
    private static final String SUPER_ADMIN_PASSWORD = "$2a$10$YE3oybWrYWAQpkZKY9/2RO0i0tF3FvASMkovKnwDD/H5Ao.Qcfa92";
    private static final String PUBLIC_PERMISSION = "public";
    private static final String[] DEFAULT_PUBLIC_URLS = {"/static/**",
            "/api/public/**",
            "/webjars/**",
            "/favicon.ico",
            "/v3/api-docs/**",
            "/swagger-ui.html",
            "/swagger-ui/**",
            "/doc.html"};
    private static final String DEFAULT_LOGIN_URL = "/api/login";
    private static final String DEFAULT_LOGOUT_URL = "/api/logout";
    private static final Integer DEFAULT_MAXIMUM_SESSIONS = 1;

    private boolean enable = true;
    private String superAdmin = SUPER_ADMIN;
    private String superAdminPassword = SUPER_ADMIN_PASSWORD;
    private String publicPermission = PUBLIC_PERMISSION;
    private String loginUrl = DEFAULT_LOGIN_URL;
    private String loginPageUrl = DEFAULT_LOGIN_URL;
    private String logoutUrl = DEFAULT_LOGOUT_URL;
    private String[] publicUrl = DEFAULT_PUBLIC_URLS;
    private Integer maximumSessions = DEFAULT_MAXIMUM_SESSIONS;

}
